#!/usr/bin/perl -w
use strict;
use lib qw(lib);
use Time::HiRes qw(time);
use Benchmark qw(:all);
use Stdlog qw(:all);

my $iters = shift @ARGV || 1_000_000;
my $t;

$t = time;
for(1..$iters){
    null_func("message");
}
$t = time - $t;
printf "Null function call: %.3f usec each\n", 1000000 * $t / $iters;

$t = time;
for(1..$iters){
    debug("message");
}
$t = time - $t;
printf "Decision: %.3f usec each\n", 1000000 * $t / $iters;

our $stderr = "";
close STDERR;
open STDERR, '>', \$stderr;
$t = time;
for(1..$iters){
    error("message");
}
$t = time - $t;
printf "Decision: %.3f usec each\n", 1000000 * $t / $iters;



sub null_func {
    my $msg = shift;
    return 1;
}